<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui, viewport-fit=cover">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>My App</title>
    <link rel="stylesheet" href="../../packages/core/css/framework7.min.css">
    <link rel="stylesheet" href="../../css/framework7-icons.css">
  </head>
  <body>
    <div id="app"></div>
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
    <script src="https://unpkg.com/react@16.4.1/umd/react.production.min.js"></script>
    <script src="https://unpkg.com/react-dom@16.4.1/umd/react-dom.production.min.js"></script>
    <script src="../../packages/react/framework7-react.min.js"></script>
    <script src="../../packages/core/js/framework7.min.js"></script>
    <script type="text/babel">
      class AppComponent extends React.Component {
        constructor() {
          super();
      
          this.state = {
      
          };
        }
        more() {
          const self = this;
          self.actions.open();
        }
        mark() {
          const app = this.$f7;
          app.dialog.alert('Mark');
        }
        reply() {
          const app = this.$f7;
          app.dialog.alert('Reply');
        }
        forward() {
          const app = this.$f7;
          app.dialog.alert('Forward');
        }
        onDeleted() {
          const app = this.$f7;
          app.dialog.alert('Thanks, item removed!');
        }
        onPageBeforeRemove() {
          const self = this;
          self.actions.destroy();
        }
        onPageInit() {
          const self = this;
          const app = self.$f7;
          self.actions = app.actions.create({
            buttons: [
              [
                {
                  text: 'Here comes some optional description or warning for actions below',
                  label: true,
                },
                {
                  text: 'Action 1',
                },
                {
                  text: 'Action 2',
                },
              ],
              [
                {
                  text: 'Cancel',
                  bold: true,
                },
              ],
            ],
          });
        }
        render() {
          return (
            <App>
              <View main>
                <Page onPageBeforeRemove={this.onPageBeforeRemove.bind(this)} onPageInit={this.onPageInit.bind(this)}>
                  <Navbar title="Swipeout"></Navbar>
      
                  <Block>
                    <p>
                      Swipe out actions on list elements is one of the most awesome F7 features. It allows you to call hidden menu for each list element where you can put default ready-to use delete button or any other buttons for some required actions.
                    </p>
                  </Block>
      
                  <BlockTitle>Swipe to delete with confirm modal</BlockTitle>
                  <List>
                    <ListItem
                      swipeout
                      title="Swipe left on me please">
      
                      <SwipeoutActions right>
                        <SwipeoutButton delete confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                    <ListItem
                      swipeout
                      title="Swipe left on me too">
      
                      <SwipeoutActions right>
                        <SwipeoutButton delete confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                    <ListItem
                      title="I am not removable">
      
                    </ListItem>
                  </List>
      
                  <BlockTitle>Swipe to delete without confirm</BlockTitle>
                  <List>
                    <ListItem
                      swipeout
                      title="Swipe left on me please">
      
                      <SwipeoutActions right>
                        <SwipeoutButton delete>Delete</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                    <ListItem
                      swipeout
                      title="Swipe left on me too">
      
                      <SwipeoutActions right>
                        <SwipeoutButton delete>Delete</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                    <ListItem
                      title="I am not removable">
      
                    </ListItem>
                  </List>
      
                  <BlockTitle>Swipe for actions</BlockTitle>
                  <List>
                    <ListItem
                      swipeout
                      title="Swipe left on me please">
      
                      <SwipeoutActions right>
                        <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                        <SwipeoutButton delete>Delete</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                    <ListItem
                      swipeout
                      title="Swipe left on me too">
      
                      <SwipeoutActions right>
                        <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                        <SwipeoutButton delete>Delete</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                    <ListItem
                      swipeout
                      title="You can't delete me">
      
                      <SwipeoutActions right>
                        <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                  </List>
      
                  <BlockTitle>With callback on remove</BlockTitle>
                  <List>
                    <ListItem
                      swipeout
                      onSwipeoutDeleted={this.onDeleted.bind(this)}
                      title="Swipe left on me please">
      
                      <SwipeoutActions right>
                        <SwipeoutButton delete>Delete</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                    <ListItem
                      swipeout
                      onSwipeoutDeleted={this.onDeleted.bind(this)}
                      title="Swipe left on me too">
      
                      <SwipeoutActions right>
                        <SwipeoutButton delete>Delete</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                    <ListItem
                      title="I am not removable">
      
                    </ListItem>
                  </List>
      
                  <BlockTitle>With actions on left side (swipe to right)</BlockTitle>
                  <List>
                    <ListItem
                      swipeout
                      title="Swipe right on me please">
      
                      <SwipeoutActions left>
                        <SwipeoutButton color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
                        <SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                    <ListItem
                      swipeout
                      title="Swipe right on me too">
      
                      <SwipeoutActions left>
                        <SwipeoutButton color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
                        <SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                  </List>
      
                  <BlockTitle>On both sides with overswipes</BlockTitle>
                  <List mediaList>
                    <ListItem
                      swipeout
                      title="Facebook"
                      after="17:14"
                      subtitle="New messages from John Doe"
                      text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
                    >
                      <SwipeoutActions left>
                        <SwipeoutButton overswipe color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
                        <SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
                      </SwipeoutActions>
                      <SwipeoutActions right>
                        <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                        <SwipeoutButton color="orange" onClick={this.mark.bind(this)}>Mark</SwipeoutButton>
                        <SwipeoutButton delete overswipe confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                    <ListItem
                      swipeout
                      title="John Doe (via Twitter)"
                      after="17:11"
                      subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
                      text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
                    >
                      <SwipeoutActions left>
                        <SwipeoutButton overswipe color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
                        <SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
                      </SwipeoutActions>
                      <SwipeoutActions right>
                        <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                        <SwipeoutButton color="orange" onClick={this.mark.bind(this)}>Mark</SwipeoutButton>
                        <SwipeoutButton delete overswipe confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                    <ListItem
                      swipeout
                      title="Facebook"
                      after="16:48"
                      subtitle="New messages from John Doe"
                      text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
                    >
                      <SwipeoutActions left>
                        <SwipeoutButton overswipe color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
                        <SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
                      </SwipeoutActions>
                      <SwipeoutActions right>
                        <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                        <SwipeoutButton color="orange" onClick={this.mark.bind(this)}>Mark</SwipeoutButton>
                        <SwipeoutButton delete overswipe confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                    <ListItem
                      swipeout
                      title="John Doe (via Twitter)"
                      after="15:32"
                      subtitle="John Doe (@_johndoe) mentioned you on Twitter!"
                      text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."
                    >
                      <SwipeoutActions left>
                        <SwipeoutButton overswipe color="green" onClick={this.reply.bind(this)}>Reply</SwipeoutButton>
                        <SwipeoutButton color="blue" onClick={this.forward.bind(this)}>Forward</SwipeoutButton>
                      </SwipeoutActions>
                      <SwipeoutActions right>
                        <SwipeoutButton onClick={this.more.bind(this)}>More</SwipeoutButton>
                        <SwipeoutButton color="orange" onClick={this.mark.bind(this)}>Mark</SwipeoutButton>
                        <SwipeoutButton delete overswipe confirmText="Are you sure you want to delete this item?">Delete</SwipeoutButton>
                      </SwipeoutActions>
                    </ListItem>
                  </List>
                </Page>
              </View>
            </App>
          )
        }
      }
    </script>
    <script>
      var theme = 'ios';
      if (location.href.indexOf('theme=md') >= 0) theme = 'md';
      
      if (Framework7.use) Framework7.use(Framework7React, { theme: theme });
      else if (Framework7.Class && Framework7.Class.use) Framework7.Class.use(Framework7React, { theme: theme });
      
      var plugin = {
        params: {
          theme: theme,
        }
      };
      
      if (Framework7.use) Framework7.use(plugin);
      else if (Framework7.Class && Framework7.Class.use) Framework7.Class.use(plugin);
      
      window.onload = function () {
        if (typeof AppComponent !== 'undefined') {
          ReactDOM.render(
            React.createElement(AppComponent),
            document.getElementById('app')
          );
        }
      }
    </script>
  </body>
</html>